package com.chris.code.generate.custom;

import com.chris.assist.builders.springboot.supports.SpringbootBuildParams;
import com.chris.assist.builders.springboot.supports.SpringbootCreator;
import com.chris.assist.builders.springboot.supports.SpringbootUtil;
import com.chris.assist.common.Builder;
import com.chris.assist.config.Config;
import com.chris.assist.models.TableInfo;
import com.chris.assist.models.TemplateData;

/**
 * @author Chris Chan
 * Create On 2025/10/10 下午3:53
 * Use for:
 * Explain:
 */
public class CustomBuilder implements Builder<TemplateData, SpringbootBuildParams> {
    private Config config;

    public static CustomBuilder get(Config config) {
        CustomBuilder builder = new CustomBuilder();
        builder.config = config;
        return builder;
    }

    @Override
    public Config getConfig() {
        return config;
    }

    @Override
    public TemplateData buildData(TableInfo tableInfo, SpringbootBuildParams extParams) {
        TemplateData data = SpringbootUtil.buildClassData(config, tableInfo, extParams);
        //data.packageName = "com.chris.assist.test.custom";
        return data;
    }

    @Override
    public void create(TemplateData data) {
        SpringbootCreator.create(data);
    }
}
